#include "log4cpp/Category.hh"
#include "log4cpp/Priority.hh"
#include "log4cpp/FileAppender.hh"
#include "log4cpp/OstreamAppender.hh"
#include "log4cpp/RollingFileAppender.hh" //回卷文件
#include "log4cpp/PatternLayout.hh" //设置日志布局的头文件
#include<iostream>
#include<string>
#include<func.h>
using std::cout;
using std::endl;
using std::string;
using namespace log4cpp;

int main(void){

    //设置布局
    PatternLayout *pat1 = new PatternLayout();
    pat1->setConversionPattern("%d %c [%p] %m %n");
    //输出到控制台
    Appender* apperd = new OstreamAppender("console", &std::cout);
    apperd->setLayout(pat1); //绑定格式
    Category &myTest = Category::getInstance("myTest");
    myTest.setPriority(Priority::WARN);
    myTest.addAppender(apperd);
    myTest.warn("this is warn\n");

}